The present invention relates to emulation of instructions for execution by an instruction processor, in a computer environment.
An instruction, in digital computer operations, is a set of bits defining an operation. The instruction may comprise an operation code specifying the operation to be performed, one or more operands or their addresses, and one or more modifiers or their addresses (to modify the operand or its address). An instruction set, also called an instruction code, comprises symbols and characters that compose the syntax of a computer programming language, and in a computer's basic machine code, the part that specifies how characters or digits are used to represent the codes within the machine's instruction set.
Processors often emulate instructions, so that a first computer system may behave in the same manner as a second computer system, for instructions that are not directly implemented in the first system. Examples of such emulation include 1) running Java byte codes on a general purpose computer, e.g. so that a general purpose computer can run Java software written for another machine, to provide a Java virtual machine, 2) supporting instructions of a different instruction set architecture for compatibility reasons, and 3) operating a microprocessor as a terminal of a network in order to communicate with mainframes. Emulation includes a computer, device, program or combination thereof imitating the function of another computer, device, program or combination thereof. The emulation may be done in hardware or firmware or software or some combination thereof, such hardware or software or firmware or combination thereof being an emulator.
Known microprocessors emulate instructions outside of their architectures through emulation. Emulation through hardware is considerably faster than emulation through software. When hardware emulation is used, the instruction that is being emulated is often “translated” into an instruction emulation sequence of one or more instructions in the native instruction set of the CPU being used (such native instruction set comprising the instructions that have been implemented) and this translated sequence of native instructions is then executed. The translation sequence, that is the instruction emulation sequence, is fixed (as opposed to dynamic), as the details of emulation for each instruction that needs to be emulated is known at design time.
Translation of an instruction from one language to another is performed by compilers, assemblers and interpreters, for example.